function request(type, url, parameter = {}) {
    return new Promise(function (resolve, reject) {
        $.ajax({
            type,
            url,
            data: { ...parameter },
            dataType: "json",
            success: function (data) {
                resolve(data);
            }
        })
    })
}
//注册
const register = parameter => request("post", "../php/register.php", parameter);
const isExistUser = parameter => request("post", "../php/isExistUser.php", parameter);
const isExistEmail = parameter => request("post", "../php/isExistEmail.php", parameter);
const isExistPhone = parameter => request("post", "../php/isExistPhone.php", parameter);
//登录
const loginAccount = parameter => request("post", "../php/login_account.php", parameter);
//主页面
const searchGood = parameter => request("post", "../php/searchGood.php", parameter);
const searchGuees = parameter => request("post", "../php/searchGuees.php", parameter);

//商品列表
const searchByName = parameter => request("get", "../php/searchByName.php", parameter);
const searchByNameLimit = parameter => request("get", "../php/searchByNameLimit.php", parameter);

//商品详情
const searchGoodsById = parameter => request("get", "../php/searchGoodsById.php", parameter);
const indexGoodssearchGoodsById = parameter => request("get", "../php/indexGoodssearchGoodsById.php", parameter);
const appendShopCar = parameter => request("post", "../php/appendShopCar.php", parameter);
const indexToShopCar = parameter => request("post", "../php/indexToShopCar.php", parameter);

//购物车
const shopCar = parameter => request("post", "../php/shopCar.php", parameter);
const updateShopCar = parameter => request("post", "../php/updateShopCar.php", parameter);
const deleteGoods = parameter => request("post", "../php/deleteGoods.php", parameter);
const deleteAllGoods = parameter => request("post", "../php/deleteAllGoods.php", parameter);



